import { NodeRoot } from "../Base/NodeRoot";
import { EventType } from "./EventEmit";
import { NMNode } from "../Base/NodeGraph";
@NMNode
export class EventOn extends NodeRoot{
    public Node: any;
    public EventType:number;
    public Once:boolean;
    public isCompleted=false;
    private setNode:cc.Node;
    onEnter(){
        this.setNode=this.Node;
        if(!this.setNode){
            this.setNode=this.ownerNode;
        }
        let eventName=EventType[this.EventType];
        if(this.Once){
            this.setNode.once(eventName,()=>{console.log("mousedown");this.isCompleted=true})
        }
        else{
            this.setNode.on(eventName,()=>{console.log("mousedown");this.isCompleted=true})
        }
        console.log("监听事件",eventName,this.setNode);
    }
    onStep(dt){
        return this.isCompleted;
    }
}